export default {
  mounted(el, binding) {
    const observer = new IntersectionObserver((entries) => {
      if (typeof binding.value.callback === 'function') {
        binding.value.callback(entries)
      }
    }, binding.value.options || {})

    observer.observe(el)

    el._observer = observer
  },
  unmounted(el) {
    if (el._observer) {
      el._observer.disconnect()
    }
  }
} 